<template>
    <div>
        <h1>添加等级权益</h1>
        <table class="table">
            <tbody>
                <tr>
                    <td>等级名称</td>
                    <td>
                        <input type="text" v-model="date.memberLevelName">
                    </td>
                </tr>
                <tr>
                    <td>状态</td>
                    <td>
                        <input type="checkbox" v-model="date.lstate">勾选为true,否则FALSE
                    </td>
                </tr>
                <tr>
                    <td>权益信息</td>
                    <td>
                        <input type="text" v-model="data.rightLevelName">
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td colspan="2">
                        <input type="button" value="添加" @click="add">
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import { ref,onMounted } from 'vue';
import axios from 'axios';
import { useRouter } from 'vue-router';
const routher = useRouter()
onMounted(()=>{
    getss()
})
const add=()=>{
    axios.post("https://localhost:7258/api/MemerLevel/AddLevel",date.value).then(res=>{
        if(res.data>0){
            alert("cg")
            routher.push({path:"/ShowLevel"})
        }
        else{
            alert("失败")
        }
    })
}
const getss=()=>{
    axios.get("https://localhost:7258/api/RightLevel/GetRightLevelSs").then(res=>{
        data.value=res.data
    })
}
const data=ref({
    "rightLevelId": 0,
    "rightLevelName": "",
    "rstate": false,
    "isDelete": false
})
const date=ref({
  "memberLevelId": 0,
    "memberLevelName": "",
    "lstate": false,
    "rightLevelId": 0
})
</script>

<style scoped>

</style>